<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title>常德市前列腺疾病研究所</title>
    <meta name="description" content="常德市前列腺病研究所">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="alternate icon" type="image/png" href="/assets/i/favicon.png">
  <link rel="stylesheet" href="/assets/css/amazeui.min.css"/>
<script src="/assets/js/jquery.min.js"></script>
  <script type="text/javascript">
function login() {
	$.ajax({
		cache: true,
		type: "POST",
		url:'/admin/login/logins',
		data:$('#formid').serialize(),
		async: false,
		error: function(request) {
			alert("Connection error");
		},
		success: function(data) {
		
			if(data.err ==2){
			
				alert("您的账号密码错误！");
			}
			else{
				window.location.href='/admin';
			}
		}
	});
}
</script>
  <style>
    .header {
      text-align: center;
    }
    .header h1 {
      font-size: 200%;
      color: #333;
      margin-top: 30px;
    }
    .header p {
      font-size: 14px;
    }
  </style>
</head>
<body>
<div class="header">
  <div class="am-g">
    <h1>常德市前列腺病研究所</h1>
  </div>
  <hr />
</div>
 <div class="am-g">
  <div class="am-u-lg-9 am-u-md-8 am-u-sm-centered">
    <form class="am-form" id="formid">
      <label for="text">用户名:</label>
      <input type="text" name="username" id="username">
      <br>
      <label for="password">密码:</label>
      <input type="password" name="password" id="password">
      <br>
      <div class="header">
       <button type="button" class="am-btn am-btn-primary" onclick="login(); return false;">登录</button>
      <button type="button" class="am-btn am-btn-default" type="button" id="doc-gen-qr">微信登录</button>
      </div>
    </form>
  </div>
</div>
<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt" style="width: 200; height: 200">
  <div class="am-modal-dialog">
  请扫描二维码
   <iframe width="450" height="450" frameborder=0 scrolling=no id="ifr" ></iframe>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
      <span class="am-modal-btn" data-am-modal-confirm>扫描成功</span>
    </div>
  </div>
  
</div>
</body>
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="../assets/js/amazeui.min.js"></script>

<script src="../assets/js/app.js"></script>
<script>
  $(function() {
    $('#doc-gen-qr').on('click', function() {
    	$.ajax({
      		cache: true,
      		type: "POST",
      		url:'/admin/login/weixinlogin',
      		async: false,
      		error: function(request) {
      			alert("Connection error");
      		},
      		success: function(data) {
      			$('#my-prompt').modal({
      		        relatedTarget:$(window.parent.document).find("#ifr").attr("src",data.err),
      		        onConfirm: function(options) {
      		        	 $.ajax({
      		   	  		cache: true,
      		   	  		type: "POST",
      		   	  		url:'/admin/login/listen',
      		   	  		data:{"s":data.s},
      		   	  		async: false,
      		   	  		error: function(request) {
      		   	  			alert("Connection error");
      		   	  		},
      		   	  		success: function(data) {
      		   	  		if(data.err==2){
      		   	  			alert("超时");
      		   	  			window.location.href='/admin/login';
      		   	  		}
      		   	  		else if(data.err==1){
      		   	  			alert("登录成功");
      		   	  				window.location.href='/admin';
      		   	  			}
      		   	  	else if(data.err==3){
  		   	  			alert("登录失败");
  		   	  				window.location.href='/admin/login';
  		   	  			}
      		   	  		}
      		   	  	});
      		        }
      		      });
      		}
      	});
     
    });
  });
</script>
</html>
